package com.zhonggong.empConsumer.service.impl;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.util.ArrayList;
import java.util.List;

import com.zhonggong.network.emp.model.Emp;

public class UnserializeForList {

	public List<Emp> unserializeForList(byte[] in) {
		List<Emp> list = new ArrayList<Emp>();
		ByteArrayInputStream bis = null;
		ObjectInputStream is = null;
		try {
			if (in != null) {
				bis = new ByteArrayInputStream(in);
				is = new ObjectInputStream(bis);
				while (true) {
					Emp obj = (Emp) is.readObject();
					if (obj == null)
						break;
					else
						list.add(obj);
				}
				is.close();
				bis.close();
			}
		} catch (IOException e) {
			System.out.println("异常！");

		} catch (ClassNotFoundException e) {
			System.out.println("异常！");

		}
		return list;
	}

}
